
export function listenner (options,vm){
	/* 
	 * options = {
				api : {
					serviceFN : fn ,
					params ：{},
				},
				callBack ： fn,
			}
	*/
	
	let opt = {
		duration : 3000 ,
		...options
	}
	
	clearInterval(window.intelVal);
	
	window.intelVal = setInterval(()=>{
		
		if(opt.api&&opt.api.serviceFN){
			opt.api.serviceFN(opt.api.params||{}).then(ret=>{
				let isOk = opt.callBack(ret);
				if(isOk){
					clearInterval(window.intelVal)
				}
			})
		}
		
	},opt.duration)
	
}
